package io.adrainty.bolee.file.feign;

import io.adrainty.bolee.file.hystrix.FileBusinessFeignHystrix;
import io.adrainty.bolee.file.models.entity.FileEntity;
import io.adrainty.bolee.framework.commons.basic.ResultDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * <p>IFileBusinessFeign</p>
 *
 * @author AdRainty
 * @version V1.0.0
 * @description IFileBusinessFeign
 * @since 2025/8/18 14:58:09
 */

@FeignClient(value = "file-web", path = "/file-feign", fallback = FileBusinessFeignHystrix.class)
public interface IFileBusinessFeign {

    /**
     * <p>清除文件</p>
     *
     * @return {@link ResultDTO<Boolean>}
     */
    @DeleteMapping("clear-file")
    ResultDTO<Boolean> clearFile();

    /**
     * <p>清除文件</p>
     *
     * @param id 文件ID
     * @return {@link ResultDTO<Boolean>}
     */
    @DeleteMapping("/clear-file-id/{id}")
    ResultDTO<Boolean> clearFile(@PathVariable("id") Long id);

    /**
     * <p>批量绑定文件</p>
     *
     * @param fileVOs 文件列表
     * @return {@link ResultDTO}
     */
    @PostMapping("/bind-batch-file")
    ResultDTO<List<FileEntity>> bindBatchFile(@RequestBody List<FileEntity> fileVOs);

    /**
     * <p>批量替换绑定文件</p>
     *
     * @param fileVOs 文件列表
     * @return {@link ResultDTO<Boolean>}
     */
    @PostMapping(value = "/replace-bind-batch-file")
    ResultDTO<Boolean> replaceBindBatchFile(@RequestBody List<FileEntity> fileVOs);

    /**
     * <p>通过业务ID查询文件列表</p>
     *
     * @param businessIds 业务ID列表
     * @return {@link ResultDTO<List>}
     */
    @PostMapping("/find-in-business-ids")
    ResultDTO<List<FileEntity>> findInBusinessIds(@RequestBody List<Long> businessIds);

    /**
     * <p>通过业务ID删除文件</p>
     *
     * @param businessIds 业务ID列表
     * @return {@link ResultDTO<Boolean>}
     */
    @DeleteMapping("/delete-by-business-ids")
    ResultDTO<Boolean> deleteInBusinessIds(@RequestBody List<Long> businessIds);
}
